<template>
  <div class="III-II-I">
    <table class="III-II-I__table">
      <tr class="III-II-I__table-trone">
        <td class="III-II-I__table-trone-td"
            colspan="10">
          <div class="III-II-I__table-trone-td-title">
            III-2 专利转化情况
          </div>
        </td>
      </tr>
      <tr class="III-II-I__table-th">
        <td class="III-II-I__table-th-tdone">
          序号
        </td>
        <td class="III-II-I__table-th-tdtwo">
          专利名称
        </td>
        <td class="III-II-I__table-th-tdthree">
          专利号
        </td>
        <td class="III-II-I__table-th-tdfour">
          专利权人
        </td>
        <td class="III-II-I__table-th-tdfive">
          发明人
        </td>
        <td class="III-II-I__table-th-tdsix">
          授权<br>公告日
        </td>
        <td class="III-II-I__table-th-tdseven">
          转化<br>形式
        </td>
        <td class="III-II-I__table-th-tdeight">
          合同签<br>署时间
        </td>
        <td class="III-II-I__table-th-tdnine">
          合同<br>金额
        </td>
        <td class="III-II-I__table-th-tdten">
          到账<br>金额
        </td>
        <el-button type="success"
                   size="small"
                   icon="el-icon-plus"
                   class="III-II-I__table-th-add-button"
                   circle
                   @click.prevent="addMaterList"/>
      </tr>
      <tr v-for="(item, index) in cbas"
          :key="index"
          class="III-II-I__table-tr">
        <td class="III-II-I__table-tr-tdone">
          {{ index + 1 }}
        </td>
        <td class="III-II-I__table-tr-tdtwo">
          <el-input
            v-model="item.patentName"
            class="III-II-I__table-tr-tdtwo-input"
            type="textarea"
            autosize
            placeholder="XXXX"
            :maxlength="50"/>
        </td>
        <td class="III-II-I__table-tr-tdthree">
          <el-input
            v-model="item.patentNo"
            class="III-II-I__table-tr-tdthree-input"
            type="textarea"
            autosize
            placeholder="请填写专利号"
            :maxlength="50"/>
        </td>
        <td class="III-II-I__table-tr-tdfour">
          <el-input
            v-model="item.patentee"
            class="III-II-I__table-tr-tdfour-input"
            type="textarea"
            autosize
            placeholder="XXXX"
            :maxlength="50"/>
        </td>
        <td class="III-II-I__table-tr-tdfive">
          <el-input
            v-model="item.inventor"
            class="III-II-I__table-tr-tdfive-input"
            type="textarea"
            autosize
            placeholder="张三、李四"
            :maxlength="20"/>
        </td>
        <td class="III-II-I__table-tr-tdsix">
          <el-input
            v-model="item.authDate"
            class="III-II-I__table-tr-tdsix-input"
            type="input"
            placeholder="20170101"
            :maxlength="8"/>
        </td>
        <td class="III-II-I__table-tr-tdseven">
          <el-select v-model="item.transForm"
                     class="III-II-I__table-tr-tdseven-select"
                     placeholder="请选择">
            <el-option v-for="item in options"
                       :key="item.value"
                       :label="item.label"
                       :value="item.value"/>
          </el-select>
        </td>
        <td class="III-II-I__table-tr-tdeight">
          <el-input
            v-model="item.signTime"
            class="III-II-I__table-tr-tdeight-input"
            type="input"
            autosize
            placeholder="201703"
            :maxlength="6"/>
        </td>
        <td class="III-II-I__table-tr-tdnine">
          <el-input
            v-model="item.amountContract"
            class="III-II-I__table-tr-tdnine-input"
            type="textarea"
            autosize
            placeholder="100"
            oninput="if(isNaN(value)) { value = null } if(value.indexOf('.')>0){value=value.slice(0,value.indexOf('.')+2)}"/>
        </td>
        <td class="III-II-I__table-tr-tdten">
          <el-input
            v-model="item.amountReceived"
            class="III-II-I__table-tr-tdten-input"
            type="textarea"
            autosize
            placeholder="100"
            oninput="if(isNaN(value)) { value = null } if(value.indexOf('.')>0){value=value.slice(0,value.indexOf('.')+2)}"/>
        </td>
        <el-button type="danger"
                   size="small"
                   icon="el-icon-delete"
                   class="III-II-I__table-tr-delete-button"
                   circle
                   @click.prevent="deleteMaterItem(index)"/>
      </tr>
    </table>
    <div class="III-II-I__explain">
      <span class="III-II-I__explain-strong">
        说明：①
      </span>
      本表限填评估期内转化（转化合同签署时间须在评估期内）的“发明专利（含国防专利）”和“国际专利”，仅限“第一专利权人”单位填写。
      <span class="III-II-I__explain-strong">
        ②
      </span>
      所有专利转化须与实际使用方（不包括技术转移机构等）签署相关合同，合同中应包含专利名称或专利号、转化收益等信息（可隐去敏感信息）；没有合同的不填写；除按国家和军队有关政策不得进行有偿转化的专利外，无偿转化的专利也不填写。
      <span class="III-II-I__explain-strong">
        ③
      </span>
      若专利使用方为军队国防有关主管部门，可提供正师级及以上主管部门开具的专利转化证明（证明中应注明专利号/专利名称、专利应用的具体装备或产品及专利应用起始时间等），“转化形式”填写“许可”，“合同签署时间”填写专利应用起始时间。
      <span class="III-II-I__explain-strong">
        ④
      </span>
      转化形式”限填“许可、转让、作价入股”。
      <span class="III-II-I__explain-strong">
        ⑤
      </span>
      “到账金额”填写专利转化的实际到账金额，须提供经费入账时的收款票据、发票或银行回单等证明或学校财务系统截图，且付款单位应与合同一致；若专利转化形式为“作价入股”，不填写“到账金额”。
    </div>
  </div>
</template>

<script>
import { getPageData } from '@/utils/getData.js'

export default {
  watch: {
    cbas: {
      handler (newVal) {
        sessionStorage['this_data'] = JSON.stringify(newVal)
      },
      deep: true,
      immediate: true
    }
  },
  async mounted () {
    const loading = this.$loading({ lock: true, text: '数据获取中...请稍后！', background: 'rgba(0, 0, 0, 0.7)' })
    this.cbas = await getPageData('cbas')
    loading.close()
  },
  data () {
    return {
      options: [
        { value: '0', label: '许可' },
        { value: '1', label: '转让' },
        { value: '2', label: '作价入股' }],
      cbas: [
        { patentName: '', patentNo: '', patentee: '', inventor: '', authDate: '', transForm: '', signTime: '', amountContract: '', amountReceived: '' }
      ]
    }
  },
  methods: {
    addMaterList () {
      this.cbas.push({ patentName: '', patentNo: '', patentee: '', inventor: '', authDate: '', transForm: '', signTime: '', amountContract: '', amountReceived: '' })
    },
    deleteMaterItem (index) {
      if (this.cbas.length > 1) {
        this.cbas.splice(index, 1)
      }
    }
  }
}
</script>

<style lang="less" scoped>
@import '../../assets/css/page/3-2-1.less';
</style>
